Skip to content

[Relay][Frontend][Torch] fix pytorch frontend not support logical or#16400

Merged
masahi merged 1 commit intoapache:mainfrom
taomiao:fix/pytorch_frontend_not_support_logical_or
Jan 16, 2024
Merged

[Relay][Frontend][Torch] fix pytorch frontend not support logical or#16400
masahi merged 1 commit intoapache:mainfrom
taomiao:fix/pytorch_frontend_not_support_logical_or

Conversation

@taomiao
Copy link
Copy Markdown
Contributor

@taomiao taomiao commented Jan 15, 2024

add logical_or op to relay pytorch frontend. #16399

@taomiao taomiao force-pushed the fix/pytorch_frontend_not_support_logical_or branch 2 times, most recently from 75ab5f8 to 0f45ef9 Compare January 15, 2024 08:41
@taomiao
Copy link
Copy Markdown
Contributor Author

taomiao commented Jan 16, 2024

@masahi @t-vi would you help check this logical_or is ok?

Copy link
Copy Markdown
Contributor

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting the PR. The logical_or looks good, I have doubts about the __or__ .

Comment thread python/tvm/relay/frontend/pytorch.py Outdated
"torchvision::deform_conv2d": self.deform_conv2d,
"aten::unbind": self.unbind,
"aten::__and__": self.logical_and,
"aten::__or__": self.logical_or,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this is not tested and also not quite right.
While torch.logical_or(torch.tensor(2), torch.tensor(1)) gives tensor(True),
torch.ops.aten.__or__(torch.tensor(2), torch.tensor(1)) gives tensor(3)
(and torch.tensor(2) or torch.tensor(1)) gives tensor(2), so it is different yet)

Copy link
Copy Markdown
Contributor Author

@taomiao taomiao Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I removed aten::__or__ from the convert_map.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Seems good to me now.

@taomiao taomiao force-pushed the fix/pytorch_frontend_not_support_logical_or branch from 0f45ef9 to c9d5fc0 Compare January 16, 2024 09:10
Copy link
Copy Markdown
Contributor

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you @taomiao .

@masahi masahi merged commit 12ad4fb into apache:main Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants